package top.chengdongqing.mishop.repositories

import org.springframework.data.jpa.repository.JpaRepository
import top.chengdongqing.mishop.entities.UserAddress

interface UserAddressRepository : JpaRepository<UserAddress, Int> {

    fun findAllByUserIdOrderByCreatedAtDesc(userId: Int): List<UserAddress>

    fun findByIdAndUserId(id: Int, userId: Int): UserAddress?

    fun deleteByIdAndUserId(id: Int, userId: Int): Int

    fun deleteAllByUserId(userId: Int)
}